package com.boot2.core.dao.jpa;

/**
 * @author zhangweilin
 * @Description: 动态构建查询条件的数据载体
 * @date 2019/12/21
 */
public class JpaDynamicSearchHolder {
    private static final ThreadLocal<String> searchExprestionThreadLocal = new ThreadLocal<>();

    public static void set(String searchExprestion) {
        searchExprestionThreadLocal.set(searchExprestion);
    }

//    public static String get() {
//        return searchExprestionThreadLocal.get();
//    }

    public static String getAndClear() {
        String searchExprestion = searchExprestionThreadLocal.get();
        clear();
        return searchExprestion;
    }

    public static void clear() {
        searchExprestionThreadLocal.remove();
    }

}
